package com.lai.shop.service.impl;

import com.lai.shop.dao.UserDao;
import com.lai.shop.entity.UserEntity;
import com.lai.shop.enums.LoginTypeEnum;
import com.lai.shop.service.UserAuthService;
import com.lai.shop.strategy.context.SocialLoginStrategyContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @BelongsPackage: com.lai.shop.service.impl
 * @Author: laiciqi
 * @CreateTime: 2022-05-23  17:30
 * @Description: 用户授权服务
 * @Version: 1.0
 */
@Service
public class UserAuthServiceImpl implements UserAuthService {

    @Autowired
    UserDao userDao;

    @Autowired
    SocialLoginStrategyContext socialLoginStrategyContext;

    @Override
    public UserEntity weiboLogin(String code) {
        UserEntity userEntity = socialLoginStrategyContext.executeLoginStrategy(code, LoginTypeEnum.WEIBO);
        return userEntity;
    }

    @Override
    public UserEntity giteeLogin(String code) {
        UserEntity userEntity = socialLoginStrategyContext.executeLoginStrategy(code, LoginTypeEnum.GITEE);
        return userEntity;
    }


}
